# -*- coding: utf-8 -*-
#

import logging
import logging.config
import unittest
import sys
sys.path.append("../../")

from sippeer.framework.service.servicefactory import ServiceFactory
from sippeer.framework.service.servicemanager import ServiceManager

logging.config.fileConfig("../config/logging.conf")
logger = logging.getLogger("testservicemanager")

manager = ServiceManager.getInstance()

class TestServiceManager(unittest.TestCase):
    
    def setUp(self):
        pass
    
    def testServiceDiscovery(self):
        manager.serviceDiscovery()
        
    
    def testHasService(self):
        if manager.hasService():
            print "has service"
        else:
            print "no service"
            
    def testAddRemoveService(self):
        manager.addService("Blog")
        if manager.findService("Blog"):
            print "add pass"
        else:
            print "add failed"
        if manager.removeService("Blog"):
            if not manager.findService("Blog"):
                print "remove pass"
            else:
                print "remove failed"
        else:
            print "remove failed"


if __name__ == "__main__":
    unittest.main()
    